trying to run the app with openhands serve is brok...
# questions
c
trying to run the app with openhands serve is broken again... i can't launch openhands: [07/08/26 080638] INFO Running upgrade 012 -> 013, Add execution_status column to migration.py:621 conversation_metadata [07/08/26 080638] INFO ROLLBACK base.py:2713 [07/08/26 080638] INFO StreamableHTTP session manager shutting down streamable_http_manager.py:132 ERROR: + Exception Group Traceback (most recent call last): | File "/app/.venv/lib/python3.13/site-packages/starlette/routing.py", line 638, in lifespan | async with self.lifespan_context(app) as maybe_state: | ~~~~~~~~~~~~~~~~~~~~~^^^^^ | File "/usr/local/lib/python3.13/contextlib.py", line 214, in aenter | return await anext(self.gen) | ^^^^^^^^^^^^^^^^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 216, in merged_lifespan | async with original_context(app) as maybe_original_state: | ~~~~~~~~~~~~~~~~^^^^^ | File "/usr/local/lib/python3.13/contextlib.py", line 214, in aenter | return await anext(self.gen) | ^^^^^^^^^^^^^^^^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/fastapi/routing.py", line 216, in merged_lifespan | async with original_context(app) as maybe_original_state: | ~~~~~~~~~~~~~~~~^^^^^ | File "/usr/local/lib/python3.13/contextlib.py", line 214, in aenter | return await anext(self.gen) | ^^^^^^^^^^^^^^^^^^^^^ | File "/app/openhands/app_server/app.py", line 40, in combined_lifespan | async with contextlib.AsyncExitStack() as stack: | ~~~~~~~~~~~~~~~~~~~~~~~~~^^ | File "/usr/local/lib/python3.13/contextlib.py", line 768, in aexit | raise exc | File "/usr/local/lib/python3.13/contextlib.py", line 751, in aexit | cb_suppress = await cb(*exc_details) | ^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.13/contextlib.py", line 235, in aexit | await self.gen.athrow(value) | File "/app/.venv/lib/python3.13/site-packages/fastmcp/server/http.py", line 367, in lifespan | async with server._lifespan_manager(), session_manager.run(): | ~~~~~~~~~~~~~~~~~~~^^ | File "/usr/local/lib/python3.13/contextlib.py", line 235, in aexit | await self.gen.athrow(value) | File "/app/.venv/lib/python3.13/site-packages/mcp/server/streamable_http_manager.py", line 125, in run | async with anyio.create_task_group() as tg: | ~~~~~~~~~~~~~~~~~~~~~~~^^ | File "/app/.venv/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit | raise BaseExceptionGroup( | "unhandled errors in a TaskGroup", self._exceptions | ) from None | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/sql/schema.py", line 1237, in append_column | column._set_parent_with_dispatch( | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ | self, | ^^^^^ | allow_replacements=replace_existing, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | all_names={c.name: c for c in self.c}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ) | ^ | File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/sql/base.py", line 1421, in _set_parent_with_dispatch | self._set_parent(parent, **kw) | ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/sql/schema.py", line 2359, in _set_parent | raise exc.DuplicateColumnError( | ...5 lines... | ) | sqlalchemy.exc.DuplicateColumnError: A column with name 'e' is already present in table 'conversation_metadata'. | | The above exception was the direct cause of the following exception: | | Traceback (most recent call last): | File "/app/.venv/lib/python3.13/site-packages/mcp/server/streamable_http_manager.py", line 130, in run | yield # Let the application run | ^^^^^ | File "/app/.venv/lib/python3.13/site-packages/fastmcp/server/http.py", line 368, in lifespan | yield | File "/app/openhands/app_server/app.py", line 42, in combined_lifespan | await stack.enter_async_context(lifespan(app)) | File "/usr/local/lib/python3.13/contextlib.py", line 668, in enter_async_context | result = await _enter(cm) | ^^^^^^^^^^^^^^^^ | File "/app/openhands/app_server/app_lifespan/oss_app_lifespan_service.py", line 17, in aenter | self.run_alembic() | ~~~~~~~~~~~~~~~~^^ | File "/app/openhands/app_server/app_lifespan/oss_app_lifespan_service.py", line 36, in run_alembic | command.upgrade(alembic_cfg, 'head') | ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/command.py", line 483, in upgrade | script.run_env() | ~~~~~~~~~~~~~~^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/script/base.py", line 545, in run_env | util.load_python_file(self.dir, "env.py") | ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/util/pyfiles.py", line 116, in load_python_file | module = load_module_py(module_id, path) | File "/app/.venv/lib/python3.13/site-packages/alembic/util/pyfiles.py", line 136, in load_module_py | spec.loader.exec_module(module) # type: ignore | ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ | File "frozen importlib._bootstrap_external", line 1026, in exec_module | File "frozen importlib._bootstrap", line 488, in _call_with_frames_removed | File "/app/openhands/app_server/app_lifespan/alembic/env.py", line 117, in module | run_migrations_online() | ~~~~~~~~~~~~~~~~~~~~~^^ | File "/app/openhands/app_server/app_lifespan/alembic/env.py", line 111, in run_migrations_online | context.run_migrations() | ~~~~~~~~~~~~~~~~~~~~~~^^ | File "string", line 8, in run_migrations | File "/app/.venv/lib/python3.13/site-packages/alembic/runtime/environment.py", line 969, in run_migrations | self.get_context().run_migrations(**kw) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/runtime/migration.py", line 626, in run_migrations | step.migration_fn(**kw) | ~~~~~~~~~~~~~~~~~^^^^^^ | File "/app/openhands/app_server/app_lifespan/alembic/versions/013.py", line 35, in upgrade | batch_op.create_index( | ~~~~~~~~~~~~~~~~~~~~~^ | 'ix_conversation_metadata_execution_status', | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 'execution_status', | ^^^^^^^^^^^^^^^^^^^ | unique=False, | ^^^^^^^^^^^^^ | ) | ^ | File "string", line 3, in create_index | File "/app/.venv/lib/python3.13/site-packages/alembic/operations/ops.py", line 1038, in batch_create_index | return operations.invoke(op) | ~~~~~~~~~~~~~~~~~^^^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/operations/base.py", line 452, in invoke | return fn(self, operation) | File "/app/.venv/lib/python3.13/site-packages/alembic/operations/toimpl.py", line 113, in create_index | idx = operation.to_index(operations.migration_context) | File "/app/.venv/lib/python3.13/site-packages/alembic/operations/ops.py", line 933, in to_index | idx = schema_obj.index( | self.index_name, | ...4 lines... | **self.kw, | ) | File "/app/.venv/lib/python3.13/site-packages/alembic/operations/schemaobj.py", line 262, in index | *[util.sqla_compat._textual_index_column(t, n) for n in columns], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ | File "/app/.venv/lib/python3.13/site-packages/alembic/util/sqla_compat.py", line 384, in _textual_index_column | table.append_column(c) | ~~~~~~~~~~~~~~~~~~~^^^ | File "/app/.venv/lib/python3.13/site-packages/sqlalchemy/sql/schema.py", line 1243, in append_column | raise exc.DuplicateColumnError( | ...3 lines... | ) from de | sqlalchemy.exc.DuplicateColumnError: A column with name 'e' is already present in table 'conversation_metadata'. Specify replace_existing=True to Table.append_column() to replace an existing column. +------------------------------------ ERROR: Application startup failed. Exiting. ❌ Failed to start OpenHands GUI server. Error: Command '['docker', 'run', '-it', '--rm', '--pull=always', '-e', 'LOG_ALL_EVENTS=true', '-v', '/var/run/docker.sock:/var/run/docker.sock', '-v', '/home/leezo/.openhands:/.openhands', '-p', '3000:3000', '--add-host', 'host.docker.internal:host-gateway', '--name', 'openhands-app', 'docker.openhands.dev/openhands/openhands:latest']' returned non-zero exit status 3.
👀 1
m
Hey @creamy-state-40879 thanks for the report. That crash is a one-line bug in OpenHands migration 013, not your database. The migration passed the index column as a plain string 'execution_status' instead of a list, so Alembic iterated the string letter-by-letter and tried to index columns 'e', 'x', 'e', … . The upgrade runs in a transaction that rolled back, so your DB is untouched and still on revision 012, i.e., no cleanup needed. Fix is on its way (github.com/OpenHands/OpenHands/pull/15176). It's not in the
:latest
image yet, so `openhands serve --pull=`always will keep hitting this until a new image is built. To unblock right now, run from a build that includes the fix (local build or a patched image) rather than pulling
:latest
. You can take the image of the PR if you are in a hurry.
c
ok, thanks vasco